/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyivtbcolor")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyivtbcolor.findAll", query = "SELECT p FROM Pyivtbcolor p"),
    @NamedQuery(name = "Pyivtbcolor.findByPyivtbcolorid", query = "SELECT p FROM Pyivtbcolor p WHERE p.pyivtbcolorid = :pyivtbcolorid"),
    @NamedQuery(name = "Pyivtbcolor.findByNombre", query = "SELECT p FROM Pyivtbcolor p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pyivtbcolor.findByHexadecimal", query = "SELECT p FROM Pyivtbcolor p WHERE p.hexadecimal = :hexadecimal"),
    @NamedQuery(name = "Pyivtbcolor.findByObservaciones", query = "SELECT p FROM Pyivtbcolor p WHERE p.observaciones = :observaciones")})
public class Pyivtbcolor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyivtbcolorid")
    private Integer pyivtbcolorid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "hexadecimal")
    private String hexadecimal;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbcolorid")
    private Collection<Pyivtbinventa> pyivtbinventaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyivtbcolorid")
    private Collection<Pyivtbmob> pyivtbmobCollection;

    public Pyivtbcolor() {
    }

    public Pyivtbcolor(Integer pyivtbcolorid) {
        this.pyivtbcolorid = pyivtbcolorid;
    }

    public Pyivtbcolor(Integer pyivtbcolorid, String nombre, String hexadecimal) {
        this.pyivtbcolorid = pyivtbcolorid;
        this.nombre = nombre;
        this.hexadecimal = hexadecimal;
    }

    public Integer getPyivtbcolorid() {
        return pyivtbcolorid;
    }

    public void setPyivtbcolorid(Integer pyivtbcolorid) {
        this.pyivtbcolorid = pyivtbcolorid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getHexadecimal() {
        return hexadecimal;
    }

    public void setHexadecimal(String hexadecimal) {
        this.hexadecimal = hexadecimal;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public Collection<Pyivtbinventa> getPyivtbinventaCollection() {
        return pyivtbinventaCollection;
    }

    public void setPyivtbinventaCollection(Collection<Pyivtbinventa> pyivtbinventaCollection) {
        this.pyivtbinventaCollection = pyivtbinventaCollection;
    }

    @XmlTransient
    public Collection<Pyivtbmob> getPyivtbmobCollection() {
        return pyivtbmobCollection;
    }

    public void setPyivtbmobCollection(Collection<Pyivtbmob> pyivtbmobCollection) {
        this.pyivtbmobCollection = pyivtbmobCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyivtbcolorid != null ? pyivtbcolorid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyivtbcolor)) {
            return false;
        }
        Pyivtbcolor other = (Pyivtbcolor) object;
        if ((this.pyivtbcolorid == null && other.pyivtbcolorid != null) || (this.pyivtbcolorid != null && !this.pyivtbcolorid.equals(other.pyivtbcolorid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyivtbcolor[ pyivtbcolorid=" + pyivtbcolorid + " ]";
    }
    
}
